<template>
  <div>
    <van-nav-bar title="收藏列表" left-arrow @click-left="$router.go(-1)" />
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <ListItem :info="list"></ListItem>
    </van-list>
  </div>
</template>

<script>
import { userCollect } from '@/api/user'
export default {
  name: 'CollectPage',
  data () {
    return {
      list: [],
      loading: false,
      finished: false
    }
  },
  methods: {
    async onLoad () {
      const data = await userCollect()
      console.log(data)
      if (data.body.length) {
        this.list = [...this.list, ...data.body]
      }
      this.loading = false
      this.finished = true
    }
  }
}
</script>

<style scoped lang="less"></style>
